Skip to content

10 authentication#12

Open
ghost wants to merge 5 commits intodevelopfrom
10-Authentication
Open

10 authentication#12
ghost wants to merge 5 commits intodevelopfrom
10-Authentication

Conversation

@ghost
Copy link

@ghost ghost commented Oct 29, 2017

Mise en place d'un système d'authentification avec vérification du mail.
Mise en place d'un système de rôle et permission administrable.
Mise en place d'un front-end admin (pour l'exemple d'utilisation essentiellement)

*/
public function index()
{
if (! Auth::user()->hasRole('admin')) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On ne pourrait pas externaliser ca dans un middleware ?

@TuxBoy TuxBoy force-pushed the 10-Authentication branch from 8e841e1 to 48a5468 Compare November 4, 2017 13:32
{
use TraitAdminController;

const __MODEL = 'App\\Model\\Post';
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On ne peut pas utiliser la version en PHP : Post::class ?

protected function create(array $data)
{
$default = null;
$size = 40;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

peut être séparer la création d'avatar dans une méthode ?


public function before(User $user, $ability)
{
if ($user->roles->name === 'root') {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ce qui serai bien, c'est de créer une méthode abstraite qui contient tous les rôles en constante.

{
use HandlesAuthorization;

public function before(User $user, $ability)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Il manque des commentaires et typer $ability

* @param \App\Model\Role $role
* @return mixed
*/
public function view(User $user, Role $role)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typer le retour, vu que ça toi être un boolean

$table->foreign('role_id')->references('id')->on('roles')
->onUpdate('cascade')->onDelete('cascade');

$table->primary(['user_id', 'role_id']);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 clés primaires ?

{
Role::insert([
[
'name' => 'user',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pourquoi ce gros tableau ? Avec les fatories c'est pas plus simple ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants